﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BigLotterySyndicate.Classes;
using SyndicateDAO.DatabaseObject;

namespace BigLotterySyndicate.Secured.Controls
{
    public partial class PaymentListItem : BaseUserControl
    {
        public enum IsAlternate
        {
            True,
            False
        }
        private IsAlternate _alternateRow = IsAlternate.False;

        public IsAlternate AlternateRow
        {
            get { return _alternateRow; }
            set { _alternateRow = value; }
        }

        public fundsLog FundsLogEntry
        {
            get;
            set;
        }

        public enum sd
        {
            True,
            False
        }
        private sd _showDetails = sd.True;

        public sd ShowDetails
        {
            get { return _showDetails; }
            set { _showDetails = value; }
        }

        protected void Page_Load(object sender, EventArgs e)
        {

        }

        #region print

        protected string PrintAlternate(string className = "alt-row")
        {
            return this.AlternateRow == IsAlternate.True ? className : " ";
        }

        protected string PrintShowDetails()
        {
            if (ShowDetails == sd.False)
                return "style=\"display:none;\"";
            else
                return "";


        }

        protected string PrintAccountName()
        {
            return String.Format("<a href=\"/Secured/Users/Default.aspx?uId={0}\">{1}</a>", this.FundsLogEntry.toUserId, this.FundsLogEntry.user1.username);
        }
        protected string PrintDescription()
        {
            return this.FundsLogEntry.description;
        }

        protected string PrintDateCreated()
        {
            return String.Format("{0} {1}",FundsLogEntry.dateCreated.ToShortDateString(),FundsLogEntry.dateCreated.ToShortTimeString());
        }

        protected string PrintManagerName()
        {
            return String.Format("{0}",this.FundsLogEntry.user.username);
        }

        protected string PrintMoneyIn()
        {
            if (this.FundsLogEntry.moneyIn && this.FundsLogEntry.amount >0)
                return String.Format("&pound;{0}.00", this.FundsLogEntry.amount);
            else
                return "&nbsp;";
        }

        protected string PrintMoneyOut()
        {
            if (!this.FundsLogEntry.moneyIn && this.FundsLogEntry.amount > 0)
                return String.Format("&pound;{0}.00", this.FundsLogEntry.amount);
            else
                return "&nbsp;";
        }


        #endregion
    }
}